import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import './assets/css/base.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
Vue.use(ElementUI)

axios.defaults.baseURL = 'http://127.0.0.1:11333/api/private/v1/'

Vue.config.productionTip = false

Vue.prototype.$http = axios
new Vue({
  created () {
    // 添加响应拦截器
    this.$http.interceptors.response.use(
      function (response) {
        // 对响应数据做点什么
        // console.log(response)
        if (response.status !== 200) {
          return this.$message.error(response.data.meta.msg)
        }
        return response
      },
      function (error) {
        // 对响应错误做点什么
        return Promise.reject(error)
      }
    )
  },
  router,
  render: h => h(App)
}).$mount('#app')
